import request from '@/utils/request'

const apis = {
    UPLOAD_FILE: '/remoteapi/uploadfile'
}

export default {
    upload(data) {
        let dt = data || {};
        let params = dt.params || {};
        let formData = new FormData();
        for (let k in params) {
            if (k && params[k] != null) {
                formData.append(k + '', params[k]);
            }
        }

        return request.post(apis.UPLOAD_FILE, formData, {
            headers: Object.assign({
                'Content-Type': 'multipart/form-data'
            }, dt.headers)
        });
    }
}